home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cstdio.arc / SRC.ARC / SETMEM.A < prev    next >
Text File  |  1985-03-29  |  619b  |  31 lines

  1. ;    _setmem.a - set memory block to a value.
  2. ;    (C) Copyright 1984 Gregory R. Mansfield. - All Rights Reserved.
  3. ;    G. R. Mansfield.  85/01/16.
  4. ;    Ver 1.0-5329.
  5.  
  6.  
  7.     cseg
  8.     public    _setmem_
  9.  
  10.  
  11. ;    _setmem(a, n, v)    /* set block to value */
  12. ;    SEGSIZE n;    /* number of bytes to set */
  13. ;    BYTE *a, v;    /* source, destination */
  14.  
  15. _setmem_:
  16.     mov    bx,sp
  17. stm1:    mov    cx,[bx+4]    ; count
  18.     jcxz    stm3        ; if nothing to store
  19.     push    es
  20.     mov    ax,[bx+6]    ; value
  21.     mov    di,[bx+2]    ; destination offset
  22.     push    ds
  23.     pop    es
  24.     mov    ah,al
  25.     shr    cx,1        ; store words
  26.     repz stosw
  27.     jnb    stm2        ; store remaining byte
  28.     stosb
  29. stm2:    pop    es
  30. stm3:    ret
  31.